﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DataAccess;
using Business;

namespace BaseWeb.JQuery.方法汇聚
{
    public partial class _2 : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                this.Page.ClientScript.RegisterStartupScript(this.Page.GetType(), "alert", "<script>CreateMenu('0');</script>");
                //BindMenu();
            }
        }

        /// <summary>
        /// 生成按钮
        /// </summary>
        private void BindMenu()
        {
            List<li_Menu> arrayMenu = CommonSystem.Instance.Service.GetListByWhere<li_Menu>(c => c.ParentKeyId == "0").OrderBy(c => c.OrderIndex).ToList();
            foreach (var enMenu in arrayMenu)
            {
                System.Web.UI.HtmlControls.HtmlGenericControl li = new System.Web.UI.HtmlControls.HtmlGenericControl();
                li.TagName = "li";
                li.InnerText = enMenu.Name;
                li.Attributes.Add("class", "ui-state-default");
                string jstring = string.Format("InApp('" + enMenu.KeyId + "')");
                li.Attributes.Add("onclick", jstring);
                li.ID = "li_" + enMenu.KeyId;
                sortable.Controls.Add(li);
            }
        }




    }
}
